import { PropsWithChildren } from 'react';
import { ProColumnType } from '@ant-design/pro-table';
import ProForm, {
    ProFormText,
    ProFormSelect,
    FormInstance,
    ProFormProps,
    ProFormDatePicker,
} from '@ant-design/pro-form';
import { Row, Col } from 'antd';
import styles from './index.scss';
import GenernalItem, { GenernalItemProps } from './GenernalItem';

export interface GenernalFormItemProps<T>
    extends PropsWithChildren<{}>,
        GenernalItemProps<T> {
    form?: FormInstance;
    formProps?: ProFormProps;
}

export default function GenernalFormItem<T>(props: GenernalFormItemProps<T>) {
    const {
        formProps: parentFormProps,
        form: parentForm,
        ...genernalItemProps
    } = props;
    const [form] = ProForm.useForm(props.form);

    return (
        <ProForm {...props.formProps} form={form}>
            <GenernalItem {...genernalItemProps} />
        </ProForm>
    );
}
